Physics Variables


As with the "traditional" collisions and movement system, the physics system also has a series of instance variables assigned to each instance of an object when it is created. Some of these properties can be defined by the user in GML, but many are read-only and still more are only applicable in the collision event.

The following variables exists in all physics enabled objects and they can be read to and written to (ie: changed) using code from instances and scripts:


Certain variables are read-only variables, which means that the information they contain cannot be changed through instance code or scripts (but it can be changed internally by GameMaker Studio 2 which is why these are variables and not constants). The following table shows the read-only variables that exist in all physics enabled objects:


Finally, there are a number of temporary variables that exist in physics enabled objects and are created only in the collision event. These variables are like those listed above and are read-only: